This invention relates to microprocessors, and more particularly to methods of using programming instructions in a manner that reduces the power dissipation of a processor.
Power efficiency for processor-based equipment is becoming increasingly important as people are becoming more attuned to energy conservation issues. Specific considerations are the reduction of thermal effects and operating costs. Also, apart from energy conservation, power efficiency is a concern for battery-operated processor-based equipment, where it is desired to minimize battery size so that the equipment can be made small and lightweight. The xe2x80x9cprocessor-based equipmentxe2x80x9d can be either equipment designed especially for general computing or equipment having an embedded processor.
From the standpoint of processor design, a number of techniques have been used to reduce power usage. These techniques can be grouped as two basic strategies. First, the processor""s circuitry can be designed to use less power. Second, the processor can be designed in a manner that permits power usage to be managed.
On the other hand, given a particular processor design, its programming can be optimized for reduced power dissipation. Thus, from a programmer""s standpoint, there is often more than one way to program a processor to perform the same function. For example, algorithms written in high level programming languages can be optimized for efficiency in terms of time and power. Until recently, at the assembly language level, most optimization techniques have been primarily focused on speed of execution without particular regard to power use.
The programmer""s task of providing power efficient code can be performed manually or with the aid of an automated code analysis tool. Such a tool might analyze a given program so to provide the programmer with information about its power usage information. Other such tools might actually assist the programmer in generating optimized code.
U.S. Pat. No. 5,557,557, to Franz, et al., entitled xe2x80x9cProcessor Power Profilerxe2x80x9d, assigned to Texas Instruments Incorporated, describes a method of modeling power usage during program execution. A power profiler program analyzes the program and provides the programmer with information about energy consumption. A power profiler is also described in U.S. patent Ser. No. 60/046,811, to L. Hurd, entitled xe2x80x9cModule-Configurable, Full-Chip Power Profilerxe2x80x9d, assigned to Texas Instruments Incorporated, now U.S. Pat. No. 6,125,334.
Once the power requirements of a particular program are understood, the code can be optimized. Automating this aspect of programming requires a code generation tool that can restructure computer code, internal algorithms as well as supporting functions, for minimum power usage.
One aspect of the invention is a method of optimizing computer programs for power usage. The method is useful for various types of processors that execute xe2x80x9cmultiple-instruction wordsxe2x80x9d (as defined herein), such as VLIW (very long instruction word) processors and dual datapath processors.
Multiple-instruction words are characterized by having xe2x80x9cslotsxe2x80x9d, each word having a different slot for each instruction. Thus, slot 1 contains the first instruction of each word, slot 2 the second, etc. For some processors, each word is executed in its own processor cycle, but this is not necessarily the case.
For a particular listing of program code, the syntax of a series of multiple-instruction words is compared. It is determined whether, from cycle to cycle, there is a change from a non-NOP to a NOP instruction in the same slot. If so, the NOP instruction is modified to minimize bit changes between the NOP instruction and an adjacent instruction, thereby converting the NOP instruction to a proxy NOP instruction. Finally, a proxy NOP code is inserted into the proxy NOP instruction, the code being such that the proxy NOP instruction will be handled as a NOP instruction during program execution.
Thus, the optimization is achieved at the processor architecture level, rather than to high level programming. This permits a processor to be programmed in a manner that is most efficient for that processor. The method can be easily adapted to the characteristics of the processor and its instruction set.